import { tableBaseApi } from '../../../assets/services/api-common.js';
import Add from '../components/AddEdit/Add.js';
import items from './items.js';
export default function({
	$TableTools,
	$SuperTable,
	$ExpandFilter
}) {
	this.add(
		this.render({
			items,
			is: $SuperTable,
			httpApi: tableBaseApi.list,
			httpKey: tableBaseApi.listKey,
			container(midder) {
				const extra = this.render({
					midder,
					is: $TableTools,
					buttons: [{
						type: 'primary',
						text: '新增',
						onClick: () => {
							midder.open(Add, tableBaseApi.add, 'add', {
								param: { class: 'no-padding' }
							})
						}
					}]
				});
				if (env === 'react-antd') {
					return { title: '学生列表', extra: extra.getNative() }
				} else {
					return { title: '学生列表', extra }
				}
			},
			filter(midder) {
				return this.render({
					is: $ExpandFilter,
					midder,
					// layoutParam: {
					// 	buttons: [{
					// 		text: '右上自定按钮',
					// 		onClick() {
					// 			console.log('哈哈哈')
					// 		}
					// 	}]
					// }
				})
			},
		})
	)
}